//
//  HWCashWithdrawalViewController.m
//  嗨文
//
//  Created by 响当当 on 2019/2/15.
//  Copyright © 2019年 dongzheng. All rights reserved.
//

#import "HWCashWithdrawalDetailViewController.h"
#import "HWCashWithdrawalDetailView.h"

@interface HWCashWithdrawalDetailViewController ()
@property (nonatomic, strong)HWCashWithdrawalDetailView *cashWithdrawalView;
@end

@implementation HWCashWithdrawalDetailViewController

- (HWCashWithdrawalDetailView *)cashWithdrawalView
{
    if (!_cashWithdrawalView)
    {
        _cashWithdrawalView = [[HWCashWithdrawalDetailView alloc]initWithFrame:CGRectMake(0,NAVIBAR_HEIGHT,SCREEN_WIDTH,SCREEN_HEIGHT-NAVIBAR_HEIGHT)];
    }
    return _cashWithdrawalView;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self buryPoint];
    
    [self setTitle:@"余额提现"];
    [self setDefaultNav];
    [self getInfo];
    
    [self.view addSubview:self.cashWithdrawalView];
}


#pragma mark - 阅读记录
- (void)getInfo
{
    
    NSDictionary *prarmers = @{
                               @"access_token" : current_User.token
                               };
    
    WeakSelf(self)
    [MyInfoManager setGetAccountAPayInfo:prarmers sucess:^(id  _Nonnull acceptData) {
        HWCashWidthDrawModel *model = [[HWCashWidthDrawModel alloc]initWithDic:acceptData];
        [weakSelf.cashWithdrawalView getDate:model];
    } fail:^(NSError * _Nullable error) {
        DISMISS_SVP(1.0f);
        [SVProgressHUD showErrorWithStatus:@"获取失败，请检查网络是否良好"];
        DISMISS_SVP(1.0f);
    }];
    
}

- (void)buryPoint
{
    NSString *lastStayTime = [kUserDefaults objectForKey:@"time"];
    NSString *nowStayTime = [NSString stringWithFormat:@"%ld",[[HWUtilties getNowTimeTimestamp3] integerValue] - lastStayTime.integerValue];
    
    [HWUtilties buryPointWithStayTime:nowStayTime
                            timestamp:[HWUtilties getNowTimeTimestamp3]
                             memberId:current_User.userID
                              fromUrl:nil
                                toUrl:@"/withdrawCash"
                               fromId:nil
                                 toId:@"cf79cbb3efcaab10"];
}
@end
